<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8"/>
	<meta name="baidu-site-verification" content="JdMif0g2tL" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>angular</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<script src="js/angular.min.js" charset="utf-8"></script>
</head>
<style type="text/css" media="screen">
	*{margin:0;padding: 0;font-size: 16px;}
</style>
<body ng-app="myApp">

<div>{{msga}}</div>
<div class="main" ng-controller="parent">
	<p ng-click="changeParent()">{{msga}}</p>
	<div class="main" ng-controller="child">
		<p ng-click="changeChild()">{{msga}}</p>
	</div>
</div>
<div ng-controller="brother">
	<h1>{{msga}}</h1>
</div>

<script type="text/javascript">
	var msg='hello kity'
	var app =angular.module('myApp', []);
	app.run(function($rootScope){
		$rootScope.msga=msg
	});
	app.controller('parent', ['$scope','$rootScope', function($scope,$rootScope){
		$scope.changeParent=function(){
			// $scope.msga='parant msga'
			// 修改全局
			$rootScope.msga='root msga'
			// 修改父级
			// $scope.$parent.msga='new root msg'
			// 修改兄弟作用域的内容
			// $scope.$$nextSibling.msga='new brother msg'
		}
	}]);
	app.controller('child', ['$scope', function($scope){
		// $scope.msga='child'
		$scope.changeChild=function(){
			$scope.msga='parant child'
		}
	}]);
	app.controller('brother', ['$scope', function($scope){
		
	}])
</script>
<script type="text/javascript">
	document.getElementsByTagName('html')[0].style.fontSize=window.screen.width/10+'px';
</script>
</body>
</html>
<!--应该12angular指令05 checked-->